var prefix = "/platform/config";

$(function () {
    initPageConfig();
});


function initPageConfig() {
    if ($('#basic_config').length > 0) {
        initBaseConfig();
    } else {
        if ($('#share_config').length > 0) {
            $('#share_config').addClass("in active");
            $('#share_config_li').addClass("active");
            initShareConfig();
        } else {
            if ($('#oss_config').length > 0) {
                $('#oss_config').addClass("in active");
                $('#oss_config_li').addClass("active");
                initOssConfig();
            } else {
                if ($('#commision_config').length > 0) {
                    $('#commision_config').addClass("in active");
                    $('#commision_config_li').addClass("active");
                    initCommisConfig();
                } else {
                    if ($('#trade_config').length > 0) {
                        $('#trade_config').addClass("in active");
                        $('#trade_config_li').addClass("active");
                        initTradeConfig();
                    } else {
                        if ($('#footer_config').length > 0) {
                            $('#footer_config').addClass("in active");
                            $('#footer_config_li').addClass("active");
                            initFooterConfig();
                        } else {
                            if ($('#template_config').length > 0) {
                                $('#template_config').addClass("in active");
                                $('#template_config_li').addClass("active");
                                initTemplateConfig();
                            } else {
                                $('#asset_config').addClass("in active");
                                $('#asset_config_li').addClass("active");
                                initAssetConfig();
                            }
                        }
                    }
                }
            }


        }
    }
}


/**
 * 加载图片URL
 * @param inputId
 * @param imgId
 * @param url
 */
function loadImgUrl(inputId, imgId, url) {
    $('#' + inputId + '').val(url);
    $('#' + imgId + '').attr('src', url);
}

/**
 * 选择图片页面
 * @param inputId
 * @param imgId
 */
function onSelectImgBtnClick(inputId, imgId) {
    layer.open({
        id: 'selectImg',
        type: 2,
        title: '选择图片',
        maxmin: true,
        shadeClose: false,
        area: ['60%', '70%'],
        content: prefix + '/selectImg/' + inputId + "/" + imgId // iframe的url
    });
}

/**
 * 重置页脚配置
 */
function resetFooterConfig() {
    $('#teamRecruitTel').val('');
    $('#teamRecruitPic').val('');
    $('#teamRecruitPicPre').attr('src', '');
    $('#appShareImgUrl').val('');
    $('#viewAppShareImgUrl').attr('src', '');
    $('#refRegisterShareImgUrl').val('');
    $('#viewRefRegisterShareImgUrl').attr('src', '');
    $('#appFLoginImgUrl').val('');
    $('#viewappFLoginImgUrl').attr('src', '')
    $('#productInvestmentTel').val('');
    $('#productInvestmentPic').val('');
    $('#productInvestmentPicPre').attr('src', '');

    $('#superviseTel').val('');
    $('#supervisePic').val('');
    $('#supervisePicPre').attr('src', '');
}

/**
 * 初始化页脚配置
 */
function initFooterConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/footer',
        data: {},
        success: function (data) {
            if (data.code === 0) {
                var footerConfig = data.footerConfig;
                if (footerConfig) {
                    if (footerConfig.configId) {
                        $('#footerConfigId').val(footerConfig.configId);
                    }
                    if (footerConfig.configKey) {
                        $('#footerConfigKey').val(footerConfig.configKey)
                    }
                    if (footerConfig.centreId) {
                        $('#footerCentreId').val(footerConfig.centreId)
                    }
                    var info = footerConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#teamRecruitTel').val(info.teamRecruitTel);
                        $('#teamRecruitPic').val(info.teamRecruitPic);
                        $('#teamRecruitPicPre').attr('src', info.teamRecruitPic);
                        $('#appShareImgUrl').val(info.appShareImgUrl);
                        $('#viewAppShareImgUrl').attr('src', info.viewAppShareImgUrl);
                        $('#refRegisterShareImgUrl').val(info.refRegisterShareImgUrl);
                        $('#viewRefRegisterShareImgUrl').attr('src', info.viewRefRegisterShareImgUrl);
                        $('#appFLoginImgUrl').val(info.appFLoginImgUrl);
                        $('#viewappFLoginImgUrl').attr('src', info.appFLoginImgUrl);
                        $('#productInvestmentTel').val(info.productInvestmentTel);
                        $('#productInvestmentPic').val(info.productInvestmentPic);
                        $('#productInvestmentPicPre').attr('src', info.productInvestmentPic);

                        $('#superviseTel').val(info.superviseTel);
                        $('#supervisePic').val(info.supervisePic);
                        $('#supervisePicPre').attr('src', info.supervisePic);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 保存页脚配置
 */
function saveFooterConfig() {
    var config_value = {};
    config_value['teamRecruitTel'] = $.trim($('#teamRecruitTel').val());
    config_value['teamRecruitPic'] = $.trim($('#teamRecruitPic').val());
    config_value['appShareImgUrl'] = $.trim($('#appShareImgUrl').val());
    config_value['refRegisterShareImgUrl'] = $.trim($('#refRegisterShareImgUrl').val());
    config_value['appFLoginImgUrl'] = $.trim($('#appFLoginImgUrl').val());
    config_value['productInvestmentTel'] = $.trim($('#productInvestmentTel').val());
    config_value['productInvestmentPic'] = $.trim($('#productInvestmentPic').val());
    config_value['joinTel'] = $.trim($('#joinTel').val());
    config_value['joinPic'] = $.trim($('#joinPic').val());
    config_value['appShareTitle'] = $.trim($('#appShareTitle').val());
    config_value['superviseTel'] = $.trim($('#superviseTel').val());
    config_value['supervisePic'] = $.trim($('#supervisePic').val());

    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#footerConfigId').val(),
            configKey: $('#footerConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code === 0) {
                layer.msg("操作成功", {icon: 6});
                initFooterConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 初始化基础配置
 */
function initBaseConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/base',
        data: {},
        success: function (data) {
            if (data.code === 0) {
                var baseConfig = data.baseConfig;
                if (baseConfig) {
                    if (baseConfig.configId) {
                        $('#baseConfigId').val(baseConfig.configId);
                    }
                    if (baseConfig.configKey) {
                        $('#baseConfigKey').val(baseConfig.configKey)
                    }

                    var info = baseConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        //众邦智造角色分佣设置
                        $('#mallName').val(info.mallName);
                        $('#mallCode').val(info.mallCode);
                        $('#mallUrl').val(info.mallUrl);
                        $('#logo').val(info.logo);
                        $('#logoImg').attr('src', info.logo);
                        $('#customQrCodeUrl').val(info.customQrCodeUrl);
                        $('#customQrImg').attr('src', info.customQrCodeUrl);
                        $('#msgAppId').val(info.msgAppId);
                        $('#msgSecrets').val(info.msgSecrets);
                        $('#msgSid').val(info.msgSid);
                        $('#yzmId').val(info.yzmId);
                        $('#diycode').val(info.diycode);
                        $('#templateId').val(info.templateId);
                        $('#templatemsg').val(info.templatemsg);
                        $('#joinTel').val(info.joinTel);
                        $('#joinPic').val(info.joinPic);
                        $('#appShareTitle').val(info.appShareTitle);
                        $('#appShareImgUrl').val(info.appShareImgUrl);
                        $('#refRegisterShareImgUrl').val(info.refRegisterShareImgUrl);
                        $('#appFLoginImgUrl').val(info.appFLoginImgUrl);
                        $('#viewAppShareImgUrl').attr('src', info.appShareImgUrl);
                        $('#viewRefRegisterShareImgUrl').attr('src', info.refRegisterShareImgUrl);
                        $('#viewappFLoginImgUrl').attr('src', info.appFLoginImgUrl);
                        $('#joinPicPre').attr('src', info.joinPic);
                        $('#backMainOpenLogoUrl').val(info.backMainOpenLogoUrl);
                        $('#viewBackMainOpenLogoUrl').attr('src', info.backMainOpenLogoUrl);
                        $('#backMainCloseLogoUrl').val(info.backMainCloseLogoUrl);
                        $('#viewBackMainCloseLogoUrl').attr('src', info.backMainCloseLogoUrl);
                        $('#loginBgImg').val(info.loginBgImg);
                        $('#viewLoginBgImg').attr('src', info.loginBgImg);
                        $('#indexBgImg').val(info.indexBgImg);
                        $('#viewLndexBgImg').attr('src', info.indexBgImg);
                        $('#leftMenuBgColor').val(info.leftMenuBgColor);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 保存基础配置
 */
function saveBaseConfig() {
    var config_value = {};
    config_value['mallName'] = $.trim($('#mallName').val());
    config_value['mallCode'] = $.trim($('#mallCode').val());
    config_value['logo'] = $.trim($('#logo').val());
    config_value['customQrCodeUrl'] = $.trim($('#customQrCodeUrl').val());
    config_value['msgAppId'] = $.trim($('#msgAppId').val());
    config_value['msgSecrets'] = $.trim($('#msgSecrets').val());
    config_value['msgSid'] = $.trim($('#msgSid').val());
    config_value['yzmId'] = $.trim($('#yzmId').val());
    config_value['diycode'] = $.trim($('#diycode').val());

    config_value['teamRecruitTel'] = $.trim($('#teamRecruitTel').val());
    config_value['teamRecruitPic'] = $.trim($('#teamRecruitPic').val());
    config_value['appShareImgUrl'] = $.trim($('#appShareImgUrl').val());
    config_value['refRegisterShareImgUrl'] = $.trim($('#refRegisterShareImgUrl').val());
    config_value['appFLoginImgUrl'] = $.trim($('#appFLoginImgUrl').val());
    config_value['productInvestmentTel'] = $.trim($('#productInvestmentTel').val());
    config_value['productInvestmentPic'] = $.trim($('#productInvestmentPic').val());
    config_value['joinTel'] = $.trim($('#joinTel').val());
    config_value['joinPic'] = $.trim($('#joinPic').val());
    config_value['appShareTitle'] = $.trim($('#appShareTitle').val());
    config_value['superviseTel'] = $.trim($('#superviseTel').val());
    config_value['supervisePic'] = $.trim($('#supervisePic').val());
    config_value['mallUrl'] = $.trim($('#mallUrl').val());
    config_value['templateId'] = $.trim($('#templateId').val());
    config_value['templatemsg'] = $.trim($('#templatemsg').val());
    config_value['backMainOpenLogoUrl'] = $.trim($('#backMainOpenLogoUrl').val());
    config_value['backMainCloseLogoUrl'] = $.trim($('#backMainCloseLogoUrl').val());
    config_value['loginBgImg'] = $.trim($('#loginBgImg').val());
    config_value['indexBgImg'] = $.trim($('#indexBgImg').val());
    config_value['leftMenuBgColor'] = $.trim($('#leftMenuBgColor').val());
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#baseConfigId').val(),
            configKey: $('#baseConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initBaseConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置基础配置
 */
function resetBaseConfig() {
    $('#mallName').val('');
    $('#mallUrl').val('');
    $('#logo').val('');
    $('#logoImg').attr('src', '');
    $('#customQrCodeUrl').val('');
    $('#customQrImg').attr('src', '');
    $('#msgAppId').val('');
    $('#msgSecrets').val('');
    $('#msgSid').val('');
    $('#yzmId').val('');
    $('#diycode').val('');

    $('#teamRecruitTel').val('');
    $('#teamRecruitPic').val('');
    $('#teamRecruitPicPre').attr('src', '');

    $('#appShareImgUrl').val('');
    $('#viewAppShareImgUrl').attr('src', '');

    $('#refRegisterShareImgUrl').val('');
    $('#viewRefRegisterShareImgUrl').attr('src', '');

    $('#appFLoginImgUrl').val('');
    $('#viewappFLoginImgUrl').attr('src', '');

    $('#productInvestmentTel').val('');
    $('#productInvestmentPic').val('');
    $('#productInvestmentPicPre').attr('src', '');


    $('#joinTel').val('');
    $('#joinPic').val('');
    $('#joinPicPre').attr('src', '');
    $('#appShareTitle').val('');
    $('#superviseTel').val('');
    $('#supervisePic').val('');
    $('#supervisePicPre').attr('src', '');

    $('#backMainOpenLogoUrl').val('');
    $('#viewBackMainOpenLogoUrl').attr('src', '');

    $('#backMainCloseLogoUrl').val('');
    $('#viewBackMainCloseLogoUrl').attr('src', '');

    $('#loginBgImg').val('');
    $('#viewLoginBgImg').attr('src', '');

    $('#indexBgImg').val('');
    $('#viewIndexBgImg').attr('src', '');
    $('#leftMenuBgColor').val('');
}

/**
 * 分享配置加载
 */
function initShareConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/share',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var shareConfig = data.shareConfig;
                if (shareConfig) {
                    if (shareConfig.configId) {
                        $('#shareConfigId').val(shareConfig.configId);
                    }
                    if (shareConfig.configKey) {
                        $('#shareConfigKey').val(shareConfig.configKey)
                    }
                    var info = shareConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#careGuidePage').val(info.careGuidePage);
                        $('#shareTitle').val(info.shareTitle);
                        $('#shareIcon').val(info.shareIcon);

                        $('#shareIconImg').attr('src', info.shareIcon);

                        $('#shareDesc').val(info.shareDesc);
                        $('#shareUrl').val(info.shareUrl);
                        $('#goodsShareTitle').val(info.goodsShareTitle);
                        $('#goodsShareDesc').val(info.goodsShareDesc);
                        $('#customOrderShareTitle').val(info.customOrderShareTitle);
                        $('#customOrderShareIcon').val(info.customOrderShareIcon);
                        $('#masterOrderShareIconImg').attr('src', info.masterOrderShareIcon);
                        $('#customOrderShareDesc').val(info.customOrderShareDesc);
                        $('#masterOrderShareTitle').val(info.masterOrderShareTitle);
                        $('#masterOrderShareIcon').val(info.masterOrderShareIcon);
                        $('#masterOrderShareDesc').val(info.masterOrderShareDesc);
                        $('#productShareBgUrl').val(info.productShareBgUrl);
                        $('#viewProductShareBgUrl').attr('src', info.productShareBgUrl);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置分享配置
 */
function resetShareConfig() {
    $('#careGuidePage').val('');
    $('#shareTitle').val('');
    $('#shareIcon').val('');
    $('#shareDesc').val('');
    $('#shareUrl').val('');
    $('#goodsShareTitle').val('');
    $('#goodsShareDesc').val('');
    $('#customOrderShareTitle').val('');
    $('#customOrderShareIcon').val('');
    $('#customOrderShareDesc').val('');
    $('#masterOrderShareTitle').val('');
    $('#masterOrderShareIcon').val('');
    $('#masterOrderShareDesc').val('');
    $('#productShareBgUrl').val('');
    $('#viewProductShareBgUrl').attr('src', '');
}

/**
 * 分享配置保存
 */
function saveShareConfig() {
    var config_value = {};
    config_value['careGuidePage'] = $('#careGuidePage').val();
    config_value['shareTitle'] = $('#shareTitle').val();
    config_value['shareIcon'] = $('#shareIcon').val();
    config_value['shareDesc'] = $('#shareDesc').val();
    config_value['shareUrl'] = $('#shareUrl').val();
    config_value['goodsShareTitle'] = $('#goodsShareTitle').val();
    config_value['goodsShareDesc'] = $('#goodsShareDesc').val();
    config_value['customOrderShareTitle'] = $('#customOrderShareTitle').val();
    config_value['customOrderShareIcon'] = $('#customOrderShareIcon').val();
    config_value['customOrderShareDesc'] = $('#customOrderShareDesc').val();
    config_value['masterOrderShareTitle'] = $('#masterOrderShareTitle').val();
    config_value['masterOrderShareIcon'] = $('#masterOrderShareIcon').val();
    config_value['masterOrderShareDesc'] = $('#masterOrderShareDesc').val();
    config_value['productShareBgUrl'] = $('#productShareBgUrl').val();
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#shareConfigId').val(),
            configKey: $('#shareConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initShareConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}


function initOssConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/oss',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var ossConfig = data.ossConfig;
                if (ossConfig) {
                    if (ossConfig.configId) {
                        $('#ossConfigId').val(ossConfig.configId);
                    }
                    if (ossConfig.configKey) {
                        $('#ossConfigKey').val(ossConfig.configKey)
                    }
                    var info = ossConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#endPoint').val(info.endPoint);
                        $('#accessKeyId').val(info.accessKeyId);
                        $('#accessKeySecret').val(info.accessKeySecret);
                        $('#bucket').val(info.bucket);
                        $('#defineUrl').val(info.defineUrl);
                        if (info.editable == '1') {
                            $('#editable').attr("checked", true);
                        } else {
                            $('#editable').attr("checked", false);
                        }
                        onOssEditableChange();
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });


}

/**
 * oss 配置重置
 */
function resetOssConfig() {
    $('#endPoint').val('');
    $('#accessKeyId').val('');
    $('#accessKeySecret').val('');
    $('#bucket').val('');
    $('#defineUrl').val('');
}

/**
 * OSS配置可编辑状态按钮监听
 */
function onOssEditableChange() {
    var ch = $('#editable').prop("checked");
    if (ch) {
        $('#endPoint').attr('endPoint', false);
        $('#accessKeyId').attr('readOnly', false);
        $('#accessKeySecret').attr('readOnly', false);
        $('#bucket').attr('readOnly', false);
        $('#defineUrl').attr('readOnly', false);
    } else {
        $('#endPoint').attr('endPoint', true);
        $('#accessKeyId').attr('readOnly', true);
        $('#accessKeySecret').attr('readOnly', true);
        $('#bucket').attr('readOnly', true);
        $('#defineUrl').attr('readOnly', true);
    }
}

/**
 * 保存OSS操作
 */
function saveOssConfig() {
    var config_value = {};
    config_value['endPoint'] = $.trim($('#endPoint').val());
    config_value['accessKeyId'] = $.trim($('#accessKeyId').val());
    config_value['accessKeySecret'] = $.trim($('#accessKeySecret').val());
    config_value['bucket'] = $.trim($('#bucket').val());
    config_value['defineUrl'] = $.trim($('#defineUrl').val());

    var ch = $('#editable').prop("checked");
    if (ch) {
        config_value['editable'] = '1';
    } else {
        config_value['editable'] = '0';
    }

    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#ossConfigId').val(),
            configKey: $('#ossConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initOssConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 加载佣金配置
 */
function initCommisConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/commis',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var commisConfig = data.commisConfig;
                if (commisConfig) {
                    if (commisConfig.configId) {
                        $('#commisionConfigId').val(commisConfig.configId);
                    }
                    if (commisConfig.configKey) {
                        $('#commisionConfigKey').val(commisConfig.configKey)
                    }
                    var info = commisConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#masterCommision').val(info.masterCommision);
                        $('#masterCommisionType').val(info.masterCommisionType);
                        $('#superMasterCommision').val(info.superMasterCommision);
                        $('#superMasterCommisionType').val(info.superMasterCommisionType);
                        $('#usercommission').val(info.usercommission);
                        $('#usertype').val(info.usertype);
                        $('#agentcommission').val(info.agentcommission);
                        $('#agenttype').val(info.agenttype);
                        $('#useragentcommission').val(info.useragentcommission);
                        $('#useragenttype').val(info.useragenttype);
                        $('#superusertype').val(info.superusertype);
                        $('#superusercommission').val(info.superusercommission);
                        $('#agentRenewCommission').val(info.agentRenewCommission);
                        $('#accountManagerCommission').val(info.accountManagerCommission);
                        $('#productShareCommission').val(info.productShareCommission);

                        $('#userAgentRecommendStoreCommission').val(info.userAgentRecommendStoreCommission);
                        $('#accountManagerRecommendStoreCommission').val(info.accountManagerRecommendStoreCommission);
                        $('#storeRecommendStoreCommission').val(info.storeRecommendStoreCommission);
                        $('#makerRecommendStoreCommission').val(info.makerRecommendStoreCommission);

                        $('#agentRenewType').val(info.agentRenewType);

                        $('#twitterCommission').val(info.twitterCommission);
                        $('#twitterType').val(info.twitterType);
                        $('#twitterTeamCommission').val(info.twitterTeamCommission);
                        $('#twitterTeamType').val(info.twitterTeamType);
                        $('#housekeeperCommission').val(info.housekeeperCommission);
                        $('#housekeeperType').val(info.housekeeperType);
                        $('#housekeeperTeamCommission').val(info.housekeeperTeamCommission);
                        $('#housekeeperTeamType').val(info.housekeeperTeamType);
                        $('#supervisorCommission').val(info.supervisorCommission);
                        $('#supervisorType').val(info.supervisorType);
                        $('#supervisorTeamCommission').val(info.supervisorTeamCommission);
                        $('#supervisorTeamType').val(info.supervisorTeamType);
                        $('#superShopkeeperCommission').val(info.superShopkeeperCommission);
                        $('#superShopkeeperType').val(info.superShopkeeperType);
                        $('#partnerCommission').val(info.partnerCommission);
                        $('#partnerType').val(info.partnerType);
                        $('#shopkeeper1Commission').val(info.shopkeeper1Commission);
                        $('#shopkeeper1Type').val(info.shopkeeper1Type);
                        $('#shopkeeper2Commission').val(info.shopkeeper2Commission);
                        $('#shopkeeper2Type').val(info.shopkeeper2Type);

                        $('#upgradeSupervisor').val(info.upgradeSupervisor);
                        $('#upgradeHousekeeper').val(info.upgradeHousekeeper);
                        $('#upgradeTwitter').val(info.upgradeTwitter);

                        $('#merchantsCommission').val(info.merchantsCommission);
                        $('#merchantsType').val(info.merchantsType);
                        $('#storesCommission').val(info.storesCommission);
                        $('#storesType').val(info.storesType);
                        $('#storesPartnerCommission').val(info.storesPartnerCommission);
                        $('#storesPartnerType').val(info.storesPartnerType);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置佣金设置
 */
function resetCommisConfig() {
    $('#masterCommision').val('');
    $('#masterCommisionType').val('');
    $('#superMasterCommision').val('');
    $('#superMasterCommisionType').val('');
    $('#usercommission').val('');
    $('#usertype').val('');
    $('#agentcommission').val('');
    $('#agenttype').val('');
    $('#useragentcommission').val('');
    $('#useragenttype').val('');
    $('#superusertype').val('');
    $('#superusercommission').val('');
    $('#agentRenewCommission').val('');
    $('#accountManagerCommission').val('');
    $('#productShareCommission').val('');

    $('#userAgentRecommendStoreCommission').val('');
    $('#accountManagerRecommendStoreCommission').val('');
    $('#storeRecommendStoreCommission').val('');
    $('#makerRecommendStoreCommission').val('');

    $('#agentRenewType').val('');

    $('#twitterCommission').val('');
    $('#twitterType').val('');
    $('#twitterTeamCommission').val('');
    $('#twitterTeamType').val('');
    $('#housekeeperCommission').val('');
    $('#housekeeperType').val('');
    $('#housekeeperTeamCommission').val('');
    $('#housekeeperTeamType').val('');
    $('#supervisorCommission').val('');
    $('#supervisorType').val('');
    $('#supervisorTeamCommission').val('');
    $('#supervisorTeamType').val('');
    $('#superShopkeeperCommission').val('');
    $('#superShopkeeperType').val('');
    $('#partnerCommission').val('');
    $('#partnerType').val('');
    $('#shopkeeper1Commission').val('');
    $('#shopkeeper1Type').val('');
    $('#shopkeeper2Commission').val('');
    $('#shopkeeper2Type').val('');

    $('#upgradeSupervisor').val('');
    $('#upgradeHousekeeper').val('');
    $('#upgradeTwitter').val('');

    $('#merchantsCommission').val('');
    $('#merchantsType').val('');
    $('#storesCommission').val('');
    $('#storesType').val('');
    $('#storesPartnerCommission').val('');
    $('#storesPartnerType').val('');
}

/**
 * 保存佣金设置
 */
function saveCommisConfig() {
    var config_value = {};
    config_value['masterCommision'] = $.trim($('#masterCommision').val());
    config_value['masterCommisionType'] = $.trim($('#masterCommisionType').val());
    config_value['superMasterCommision'] = $.trim($('#superMasterCommision').val());
    config_value['superMasterCommisionType'] = $.trim($('#superMasterCommisionType').val());
    config_value['usercommission'] = $.trim($('#usercommission').val());
    config_value['usertype'] = $.trim($('#usertype').val());
    config_value['agentcommission'] = $.trim($('#agentcommission').val());
    config_value['agenttype'] = $.trim($('#agenttype').val());
    config_value['useragentcommission'] = $.trim($('#useragentcommission').val());
    config_value['useragenttype'] = $.trim($('#useragenttype').val());
    config_value['superusercommission'] = $.trim($('#superusercommission').val());
    config_value['accountManagerCommission'] = $.trim($('#accountManagerCommission').val());
    config_value['productShareCommission'] = $.trim($('#productShareCommission').val());

    config_value['userAgentRecommendStoreCommission'] = $.trim($('#userAgentRecommendStoreCommission').val());
    config_value['accountManagerRecommendStoreCommission'] = $.trim($('#accountManagerRecommendStoreCommission').val());
    config_value['storeRecommendStoreCommission'] = $.trim($('#storeRecommendStoreCommission').val());
    config_value['makerRecommendStoreCommission'] = $.trim($('#makerRecommendStoreCommission').val());

    config_value['superusertype'] = $.trim($('#superusertype').val());
    config_value['agentRenewCommission'] = $.trim($('#agentRenewCommission').val());
    config_value['agentRenewType'] = $.trim($('#agentRenewType').val());

    config_value['twitterCommission'] = $.trim($('#twitterCommission').val());
    config_value['twitterType'] = $.trim($('#twitterType').val());
    config_value['twitterTeamCommission'] = $.trim($('#twitterTeamCommission').val());
    config_value['twitterTeamType'] = $.trim($('#twitterTeamType').val());
    config_value['housekeeperCommission'] = $.trim($('#housekeeperCommission').val());
    config_value['housekeeperType'] = $.trim($('#housekeeperType').val());
    config_value['housekeeperTeamCommission'] = $.trim($('#housekeeperTeamCommission').val());
    config_value['housekeeperTeamType'] = $.trim($('#housekeeperTeamType').val());
    config_value['supervisorCommission'] = $.trim($('#supervisorCommission').val());
    config_value['supervisorType'] = $.trim($('#supervisorType').val());
    config_value['supervisorTeamCommission'] = $.trim($('#supervisorTeamCommission').val());
    config_value['supervisorTeamType'] = $.trim($('#supervisorTeamType').val());
    config_value['superShopkeeperCommission'] = $.trim($('#superShopkeeperCommission').val());
    config_value['superShopkeeperType'] = $.trim($('#superShopkeeperType').val());
    config_value['partnerCommission'] = $.trim($('#partnerCommission').val());
    config_value['partnerType'] = $.trim($('#partnerType').val());
    config_value['shopkeeper1Commission'] = $.trim($('#shopkeeper1Commission').val());
    config_value['shopkeeper1Type'] = $.trim($('#shopkeeper1Type').val());
    config_value['shopkeeper2Commission'] = $.trim($('#shopkeeper2Commission').val());
    config_value['shopkeeper2Type'] = $.trim($('#shopkeeper2Type').val());

    config_value['upgradeSupervisor'] = $.trim($('#upgradeSupervisor').val());
    config_value['upgradeHousekeeper'] = $.trim($('#upgradeHousekeeper').val());
    config_value['upgradeTwitter'] = $.trim($('#upgradeTwitter').val());

    config_value['merchantsCommission'] = $.trim($('#merchantsCommission').val());
    config_value['merchantsType'] = $.trim($('#merchantsType').val());
    config_value['storesCommission'] = $.trim($('#storesCommission').val());
    config_value['storesType'] = $.trim($('#storesType').val());
    config_value['storesPartnerCommission'] = $.trim($('#storesPartnerCommission').val());
    config_value['storesPartnerType'] = $.trim($('#storesPartnerType').val());

    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#commisionConfigId').val(),
            configKey: $('#commisionConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initCommisConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}


/**
 * 交易设置信息
 */
function initTradeConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/trade',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var tradeConfig = data.tradeConfig;
                if (tradeConfig) {
                    if (tradeConfig.configId) {
                        $('#tradeConfigId').val(tradeConfig.configId);
                    }
                    if (tradeConfig.configKey) {
                        $('#tradeConfigKey').val(tradeConfig.configKey)
                    }
                    var info = tradeConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#nodeHour').val(info.nodeHour);
                        $('#nodeMin').val(info.nodeMin);
                        $('#freeStartHour').val(info.freeStartHour);
                        $('#freeStartMin').val(info.freeStartMin);
                        $('#freeEndHour').val(info.freeEndHour);
                        $('#freeEndMin').val(info.freeEndMin);
                        $('#expectedPickTime').val(info.expectedPickTime);

                        $('#merchantCardPreferentialRatio').val(info.merchantCardPreferentialRatio);

                        $('#rechargeOne').val(info.rechargeOne);
                        $('#rechargeTwo').val(info.rechargeTwo);
                        $('#rechargeThree').val(info.rechargeThree);
                        $('#rechargeGiftOne').val(info.rechargeGiftOne);
                        $('#rechargeGiftTwo').val(info.rechargeGiftTwo);
                        $('#rechargeGiftThree').val(info.rechargeGiftThree);

                        $('#autoCloseNoPayOrderMin').val(info.autoCloseNoPayOrderMin);
                        $('#autoCloseNoPayOrderInterval').val(info.autoCloseNoPayOrderInterval);
                        $('#autoReceiveDays').val(info.autoReceiveDays);
                        $('#autoReceiveDealInterval').val(info.autoReceiveDealInterval);
                        $('#returnRangeDays').val(info.returnRangeDays);
                        $('#refundDesc').val(info.refundDesc);
                        $('#autoCompletedOrder').val(info.autoCompletedOrder);
                        $('#autoCompletedExpressOrder').val(info.autoCompletedExpressOrder);
                        // $('#grantCommisMin').val(info.grantCommisMin);
                        $('#cashPoundage').val(info.cashPoundage);
                        $('#cashLimit').val(info.cashLimit);
                        $('#cashLimit').val(info.cashLimit);
                        $('#multiple').val(info.multiple);
                        $('#masterSererFee').val(info.masterSererFee);
                        $('#exchangeIntegral').val(info.exchangeIntegral);
                        $('#newUserRegistration').val(info.newUserRegistration);
                        $('#placeTheOrder').val(info.placeTheOrder);
                        $('#shareTheGifts').val(info.shareTheGifts);
                        $('#sendIntegral').val(info.sendIntegral);
                        $('#vipPrice').val(info.vipPrice);
                        $('#RocketMQ').val(info.RocketMQ);
                        $('#vipRewardRate').val(info.vipRewardRate);
                        $('#superShopkeeperPrice').val(info.superShopkeeperPrice);
                        $('#cashdays').val(info.cashdays);
                        $('#staffcommission').val(info.staffcommission);
                        $('#distributionScope').val(info.distributionScope);
                        $('#packingFee').val(info.packingFee);
                        $('#redenvelopeMoney').val(info.redenvelopeMoney);
                        $('#hornOrderPayHint').val(info.hornOrderPayHint);
                        $('#hornOrderWaitHint').val(info.hornOrderWaitHint);
                        $('#hornOrderAutoHint').val(info.hornOrderAutoHint);
                        if (!info.callType) {
                            info.callType = 0;
                        }
                        $('#callType' + info.callType).prop("checked", "checked");
                        if (!info.tangshiRecieveType) {
                            info.tangshiRecieveType = 0;
                        }
                        $('#tangshiRecieveType' + info.tangshiRecieveType).prop("checked", "checked");
                        if (!info.daoDianRecieveType) {
                            info.daoDianRecieveType = 0;
                        }
                        $('#daoDianRecieveType' + info.daoDianRecieveType).prop("checked", "checked");
                        if (!info.waiMaiRecieveType) {
                            info.waiMaiRecieveType = 0;
                        }
                        $('#waiMaiRecieveType' + info.waiMaiRecieveType).prop("checked", "checked");
                        if (!info.receiptsFlag) {
                            info.receiptsFlag = 1;
                        }
                        $('#receiptsFlag' + info.receiptsFlag).prop("checked", "checked");

                        if (!info.storeAudit) {
                            info.storeAudit = 1;
                        }
                        $('#storeAudit' + info.storeAudit).prop("checked", "checked");

                        if (!info.labelFlag) {
                            info.labelFlag = 1;
                        }
                        $('#labelFlag' + info.labelFlag).prop("checked", "checked");
                        if (!info.useragentCountRuleType) {
                            info.useragentCountRuleType = 0;
                        }
                        $('#useragentCountRuleType' + info.useragentCountRuleType).prop("checked", "checked");
                        if (!info.useragentCountTimeType) {
                            info.useragentCountTimeType = 0;
                        }
                        $('#useragentCountTimeType' + info.useragentCountTimeType).prop("checked", "checked");
                        if (!info.useragentCountByType) {
                            info.useragentCountByType = 0;
                        }
                        $('#useragentCountByType' + info.useragentCountByType).prop("checked", "checked");
                        if (!info.useragentWeekType) {
                            info.useragentWeekType = 0;
                        }
                        $('#useragentWeekType' + info.useragentWeekType).prop("checked", "checked");
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置交易配置
 */
function resetTradeConfig() {
    $('#nodeHour').val('');
    $('#nodeMin').val('');
    $('#freeStartHour').val('');
    $('#freeStartMin').val('');
    $('#freeEndHour').val('');
    $('#freeEndMin').val('');
    $('#expectedPickTime').val('');
    $('#autoCloseNoPayOrderMin').val('');

    $('#merchantCardPreferentialRatio').val('');

    $('#rechargeOne').val('');
    $('#rechargeTwo').val('');
    $('#rechargeThree').val('');
    $('#rechargeGiftOne').val('');
    $('#rechargeGiftTwo').val('');
    $('#rechargeGiftThree').val('');

    $('#autoCloseNoPayOrderInterval').val('');
    $('#autoReceiveDays').val('');
    $('#autoReceiveDealInterval').val('');
    $('#returnRangeDays').val('');
    $('#autoCompletedOrder').val('');
    $('#autoCompletedExpressOrder').val('');
    $('#refundDesc').val('');
    // $('#grantCommisMin').val('');
    $('#cashPoundage').val('');
    $('#cashLimit').val('');
    $('#masterSererFee').val('');
    $('#exchangeIntegral').val('');
    $('#newUserRegistration').val('');
    $('#placeTheOrder').val('');
    $('#shareTheGifts').val('');
    $('#sendIntegral').val('');
    $('#vipPrice').val('');
    $('#RocketMQ').val('');
    $('#vipRewardRate').val('');
    $('#superShopkeeperPrice').val('');
    $('#cashdays').val('');
    $('#staffcommission').val("");
    $('#multiple').val("");
    $('#distributionScope').val("");
    $('#packingFee').val("");
    $('#redenvelopeMoney').val("");
    $('#callType0').prop("checked", "checked");
    $('#tangshiRecieveType0').prop("checked", "checked");
    $('#daoDianRecieveType0').prop("checked", "checked");
    $('#waiMaiRecieveType0').prop("checked", "checked");
    $('#receiptsFlag1').prop("checked", "checked");
    $('#labelFlag1').prop("checked", "checked");
    $('#useragentCountRuleType0').prop("checked", "checked");
    $('#useragentCountTimeType0').prop("checked", "checked");
    $('#useragentCountByType0').prop("checked", "checked");
    $('#useragentWeekType0').prop("checked", "checked");
    $('#hornOrderPayHint').val("");
    $('#hornOrderWaitHint').val("");
    $('#hornOrderAutoHint').val("");
}

function saveTradeConfig() {
    var config_value = {};
    config_value['nodeHour'] = $.trim($('#nodeHour').val());
    config_value['nodeMin'] = $.trim($('#nodeMin').val());
    config_value['freeStartHour'] = $.trim($('#freeStartHour').val());
    config_value['freeStartMin'] = $.trim($('#freeStartMin').val());
    config_value['freeEndHour'] = $.trim($('#freeEndHour').val());
    config_value['freeEndMin'] = $.trim($('#freeEndMin').val());
    config_value['expectedPickTime'] = $.trim($('#expectedPickTime').val());

    config_value['merchantCardPreferentialRatio'] = $.trim($('#merchantCardPreferentialRatio').val());

    config_value['rechargeOne'] = $.trim($('#rechargeOne').val());
    config_value['rechargeTwo'] = $.trim($('#rechargeTwo').val());
    config_value['rechargeThree'] = $.trim($('#rechargeThree').val());
    config_value['rechargeGiftOne'] = $.trim($('#rechargeGiftOne').val());
    config_value['rechargeGiftTwo'] = $.trim($('#rechargeGiftTwo').val());
    config_value['rechargeGiftThree'] = $.trim($('#rechargeGiftThree').val());

    config_value['autoCloseNoPayOrderMin'] = $.trim($('#autoCloseNoPayOrderMin').val());
    config_value['autoCloseNoPayOrderInterval'] = $.trim($('#autoCloseNoPayOrderInterval').val());
    config_value['autoReceiveDays'] = $.trim($('#autoReceiveDays').val());
    config_value['autoReceiveDealInterval'] = $.trim($('#autoReceiveDealInterval').val());
    config_value['returnRangeDays'] = $.trim($('#returnRangeDays').val());
    config_value['refundDesc'] = $.trim($('#refundDesc').val());
    config_value['cashPoundage'] = $.trim($('#cashPoundage').val());
    config_value['cashLimit'] = $.trim($('#cashLimit').val());
    config_value['masterSererFee'] = $.trim($('#masterSererFee').val());
    config_value['exchangeIntegral'] = $.trim($('#exchangeIntegral').val());
    config_value['newUserRegistration'] = $.trim($('#newUserRegistration').val());
    config_value['placeTheOrder'] = $.trim($('#placeTheOrder').val());
    config_value['shareTheGifts'] = $.trim($('#shareTheGifts').val());
    config_value['sendIntegral'] = $.trim($('#sendIntegral').val());
    config_value['vipPrice'] = $.trim($('#vipPrice').val());
    config_value['RocketMQ'] = $.trim($('#RocketMQ').val());
    config_value['multiple'] = $.trim($('#multiple').val());
    config_value['vipRewardRate'] = $.trim($('#vipRewardRate').val());
    config_value['superShopkeeperPrice'] = $.trim($('#superShopkeeperPrice').val());
    config_value['autoCompletedOrder'] = $.trim($('#autoCompletedOrder').val());
    config_value['autoCompletedExpressOrder'] = $.trim($('#autoCompletedExpressOrder').val());
    config_value['cashdays'] = $.trim($('#cashdays').val());
    config_value['staffcommission'] = $.trim($('#staffcommission').val());
    config_value['callType'] = $("input[name='callType']:checked").val();
    config_value['daoDianRecieveType'] = $("input[name='daoDianRecieveType']:checked").val();
    config_value['tangshiRecieveType'] = $("input[name='tangshiRecieveType']:checked").val();
    config_value['waiMaiRecieveType'] = $("input[name='waiMaiRecieveType']:checked").val();
    config_value['receiptsFlag'] = $("input[name='receiptsFlag']:checked").val();
    config_value['storeAudit'] = $("input[name='storeAudit']:checked").val();
    config_value['labelFlag'] = $("input[name='labelFlag']:checked").val();
    config_value['useragentCountRuleType'] = $("input[name='useragentCountRuleType']:checked").val();
    config_value['useragentCountTimeType'] = $("input[name='useragentCountTimeType']:checked").val();
    config_value['useragentCountByType'] = $("input[name='useragentCountByType']:checked").val();
    config_value['useragentWeekType'] = $("input[name='useragentWeekType']:checked").val();
    config_value['distributionScope'] = $.trim($('#distributionScope').val());
    config_value['packingFee'] = $.trim($('#packingFee').val());
    config_value['hornOrderPayHint'] = $.trim($('#hornOrderPayHint').val());
    config_value['hornOrderWaitHint'] = $.trim($('#hornOrderWaitHint').val());
    config_value['hornOrderAutoHint'] = $.trim($('#hornOrderAutoHint').val());
    config_value['redenvelopeMoney'] = $.trim($('#redenvelopeMoney').val());
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#tradeConfigId').val(),
            configKey: $('#tradeConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initCommisConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 初始化服务消息配置
 */
function initTemplateConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/template',
        data: {},
        success: function (data) {
            if (data.code === 0) {
                var templateConfig = data.templateConfig;
                if (templateConfig) {
                    if (templateConfig.configId) {
                        $('#templateConfigId').val(templateConfig.configId);
                    }
                    if (templateConfig.configKey) {
                        $('#templateConfigKey').val(templateConfig.configKey)
                    }
                    var info = templateConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#memTemplateId').val(info.memTemplateId);
                        $('#memTemplatemsg').val(info.memTemplatemsg);
                        $('#teamTemplateId').val(info.teamTemplateId);
                        $('#teamTemplatemsg').val(info.teamTemplatemsg);
                        $('#templateIdNewOrder').val(info.templateIdNewOrder);
                        $('#templatemsgNewOrder').val(info.templatemsgNewOrder);
                        $('#templateIdDelivery').val(info.templateIdDelivery);
                        $('#templatemsgDelivery').val(info.templatemsgDelivery);
                        $('#templateIdCouponExpire').val(info.templateIdCouponExpire);
                        $('#templatemsgCouponExpire').val(info.templatemsgCouponExpire);
                        $('#templateIdCreateUser').val(info.templateIdCreateUser);
                        $('#templatemsgCreateUser').val(info.templatemsgCreateUser);
                        $('#teamBeginId').val(info.teamBeginId);
                        $('#teamBeginMsg').val(info.teamBeginMsg);
                        $('#teamAwaitId').val(info.teamAwaitId);
                        $('#teamAwaitMsg').val(info.teamAwaitMsg);
                        $('#teamSucceedId').val(info.teamSucceedId);
                        $('#teamSucceedMsg').val(info.teamSucceedMsg);

                        $('#wxTeamBeginId').val(info.wxTeamBeginId);
                        $('#wxTeamAwaitId').val(info.wxTeamAwaitId);
                        $('#wxTeamSucceedId').val(info.wxTeamSucceedId);
                        $('#wxMemTemplateId').val(info.wxMemTemplateId);
                        $('#wxTeamTemplateId').val(info.wxTeamTemplateId);
                        $('#wxTemplateIdNewOrder').val(info.wxTemplateIdNewOrder);
                        $('#wxTemplateIdDelivery').val(info.wxTemplateIdDelivery);
                        $('#wxTemplateIdCouponExpire').val(info.wxTemplateIdCouponExpire);
                        $('#wxTemplateIdCreateUser').val(info.wxTemplateIdCreateUser);

                        $('#ticketOverTimeId').val(info.ticketOverTimeId);

                        $('#refundId').val(info.refundId);

                        $('#battleOrderId').val(info.battleOrderId);

                        $('#ticketOverTimeMsg').val(info.ticketOverTimeMsg);

                        $('#refundMsg').val(info.refundMsg);

                        $('#battleOrderMsg').val(info.battleOrderMsg);

                        $('#wxTicketOverTimeId').val(info.wxTicketOverTimeId);

                        $('#wxRefundId').val(info.wxRefundId);

                        $('#wxBattleOrderId').val(info.wxBattleOrderId);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 初始化公众号模板消息配置
 */
function initGZHTemplateConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/GZHtemplate',
        data: {},
        success: function (data) {
            if (data.code === 0) {
                var GZHtemplateConfig = data.GZHtemplateConfig;
                if (GZHtemplateConfig) {
                    if (GZHtemplateConfig.configId) {
                        $('#GHZtemplateConfigId').val(GZHtemplateConfig.configId);
                    }
                    if (GZHtemplateConfig.configKey) {
                        $('#GHZtemplateConfigKey').val(GZHtemplateConfig.configKey)
                    }
                    var info = GZHtemplateConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#memTemplateIdGZH').val(info.memTemplateIdGZH);
                        $('#memTemplatemsgGZH').val(info.memTemplatemsgGZH);
                        $('#teamTemplateIdGZH').val(info.teamTemplateIdGZH);
                        $('#teamTemplatemsgGZH').val(info.teamTemplatemsgGZH);
                        $('#templateIdNewOrderGZH').val(info.templateIdNewOrderGZH);
                        $('#templatemsgNewOrderGZH').val(info.templatemsgNewOrderGZH);
                        $('#templateIdDeliveryGZH').val(info.templateIdDeliveryGZH);
                        $('#templatemsgDeliveryGZH').val(info.templatemsgDeliveryGZH);
                        $('#templateIdCouponExpireGZH').val(info.templateIdCouponExpireGZH);
                        $('#templatemsgCouponExpireGZH').val(info.templatemsgCouponExpireGZH);
                        $('#templateIdCreateUserGZH').val(info.templateIdCreateUserGZH);
                        $('#templatemsgCreateUserGZH').val(info.templatemsgCreateUserGZH);
                        $('#teamBeginIdGZH').val(info.teamBeginIdGZH);
                        $('#teamBeginMsgGZH').val(info.teamBeginMsgGZH);
                        $('#teamAwaitIdGZH').val(info.teamAwaitIdGZH);
                        $('#teamAwaitMsgGZH').val(info.teamAwaitMsgGZH);
                        $('#teamSucceedIdGZH').val(info.teamSucceedIdGZH);
                        $('#teamFailIdGZH').val(info.teamFailIdGZH);

                        $('#freeChargeCallbackIdGZH').val(info.freeChargeCallbackIdGZH);

                        $('#openMembershipIdGZH').val(info.openMembershipIdGZH);

                        $('#refundIdGZH').val(info.refundIdGZH);

                        $('#teamSucceedMsgGZH').val(info.teamSucceedMsgGZH);
                        $('#teamFailMsgGZH').val(info.teamFailMsgGZH);

                        $('#freeChargeCallbackMsgGZH').val(info.freeChargeCallbackMsgGZH);

                        $('#openMembershipMsgGZH').val(info.openMembershipMsgGZH);

                        $('#refundMsgGZH').val(info.refundMsgGZH);

                        $('#wxTeamBeginIdGZH').val(info.wxTeamBeginIdGZH);
                        $('#wxTeamAwaitIdGZH').val(info.wxTeamAwaitIdGZH);
                        $('#wxTeamSucceedIdGZH').val(info.wxTeamSucceedIdGZH);
                        $('#wxTeamFailIdGZH').val(info.wxTeamFailIdGZH);

                        $('#wxFreeChargeCallbackIdGZH').val(info.wxFreeChargeCallbackIdGZH);

                        $('#wxOpenMembershipIdGZH').val(info.wxOpenMembershipIdGZH);

                        $('#wxMemTemplateIdGZH').val(info.wxMemTemplateIdGZH);
                        $('#wxTeamTemplateIdGZH').val(info.wxTeamTemplateIdGZH);
                        $('#wxTemplateIdNewOrderGZH').val(info.wxTemplateIdNewOrderGZH);
                        $('#wxTemplateIdDeliveryGZH').val(info.wxTemplateIdDeliveryGZH);
                        $('#wxTemplateIdCouponExpireGZH').val(info.wxTemplateIdCouponExpireGZH);
                        $('#wxTemplateIdCreateUserGZH').val(info.wxTemplateIdCreateUserGZH);

                        $('#wxRefundIdGZH').val(info.wxRefundIdGZH);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 保存订阅消息模板配置
 */
function saveTemplateConfig() {
    var config_value = {};

    config_value['memTemplateId'] = $.trim($('#memTemplateId').val());
    config_value['memTemplatemsg'] = $.trim($('#memTemplatemsg').val());
    config_value['teamTemplateId'] = $.trim($('#teamTemplateId').val());
    config_value['teamTemplatemsg'] = $.trim($('#teamTemplatemsg').val());
    config_value['templateIdNewOrder'] = $.trim($('#templateIdNewOrder').val());
    config_value['templatemsgNewOrder'] = $.trim($('#templatemsgNewOrder').val());
    config_value['templateIdDelivery'] = $.trim($('#templateIdDelivery').val());
    config_value['templatemsgDelivery'] = $.trim($('#templatemsgDelivery').val());
    config_value['templateIdCouponExpire'] = $.trim($('#templateIdCouponExpire').val());
    config_value['templatemsgCouponExpire'] = $.trim($('#templatemsgCouponExpire').val());
    config_value['templateIdCreateUser'] = $.trim($('#templateIdCreateUser').val());
    config_value['templatemsgCreateUser'] = $.trim($('#templatemsgCreateUser').val());
    config_value['teamBeginId'] = $.trim($('#teamBeginId').val());
    config_value['teamBeginMsg'] = $.trim($('#teamBeginMsg').val());
    config_value['teamAwaitId'] = $.trim($('#teamAwaitId').val());
    config_value['teamAwaitMsg'] = $.trim($('#teamAwaitMsg').val());
    config_value['teamSucceedId'] = $.trim($('#teamSucceedId').val());
    config_value['teamSucceedMsg'] = $.trim($('#teamSucceedMsg').val());
    config_value['ticketOverTimeId'] = $.trim($('#ticketOverTimeId').val());

    config_value['refundId'] = $.trim($('#refundId').val());

    config_value['battleOrderId'] = $.trim($('#battleOrderId').val());

    config_value['ticketOverTimeMsg'] = $.trim($('#ticketOverTimeMsg').val());

    config_value['refundMsg'] = $.trim($('#refundMsg').val());

    config_value['battleOrderMsg'] = $.trim($('#battleOrderMsg').val());

    config_value['wxTeamBeginId'] = $.trim($('#wxTeamBeginId').val());
    config_value['wxTeamAwaitId'] = $.trim($('#wxTeamAwaitId').val());
    config_value['wxTeamSucceedId'] = $.trim($('#wxTeamSucceedId').val());
    config_value['wxTicketOverTimeId'] = $.trim($('#wxTicketOverTimeId').val());

    config_value['wxRefundId'] = $.trim($('#wxRefundId').val());

    config_value['wxBattleOrderId'] = $.trim($('#wxBattleOrderId').val());

    config_value['wxMemTemplateId'] = $.trim($('#wxMemTemplateId').val());
    config_value['wxTeamTemplateId'] = $.trim($('#wxTeamTemplateId').val());
    config_value['wxTemplateIdNewOrder'] = $.trim($('#wxTemplateIdNewOrder').val());
    config_value['wxTemplateIdDelivery'] = $.trim($('#wxTemplateIdDelivery').val());
    config_value['wxTemplateIdCouponExpire'] = $.trim($('#wxTemplateIdCouponExpire').val());
    config_value['wxTemplateIdCreateUser'] = $.trim($('#wxTemplateIdCreateUser').val());
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#templateConfigId').val(),
            configKey: $('#templateConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initBaseConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 保存公众号模板消息配置
 */
function saveGZHTemplateConfig() {
    var config_value1 = {};

    config_value1['memTemplateIdGZH'] = $.trim($('#memTemplateIdGZH').val());
    config_value1['memTemplatemsgGZH'] = $.trim($('#memTemplatemsgGZH').val());
    config_value1['teamTemplateIdGZH'] = $.trim($('#teamTemplateIdGZH').val());
    config_value1['teamTemplatemsgGZH'] = $.trim($('#teamTemplatemsgGZH').val());
    config_value1['templateIdNewOrderGZH'] = $.trim($('#templateIdNewOrderGZH').val());
    config_value1['templatemsgNewOrderGZH'] = $.trim($('#templatemsgNewOrderGZH').val());
    config_value1['templateIdDeliveryGZH'] = $.trim($('#templateIdDeliveryGZH').val());
    config_value1['templatemsgDeliveryGZH'] = $.trim($('#templatemsgDeliveryGZH').val());
    config_value1['templateIdCouponExpireGZH'] = $.trim($('#templateIdCouponExpireGZH').val());
    config_value1['templatemsgCouponExpireGZH'] = $.trim($('#templatemsgCouponExpireGZH').val());
    config_value1['templateIdCreateUserGZH'] = $.trim($('#templateIdCreateUserGZH').val());
    config_value1['templatemsgCreateUserGZH'] = $.trim($('#templatemsgCreateUserGZH').val());
    config_value1['teamBeginIdGZH'] = $.trim($('#teamBeginIdGZH').val());
    config_value1['teamBeginMsgGZH'] = $.trim($('#teamBeginMsgGZH').val());
    config_value1['teamAwaitIdGZH'] = $.trim($('#teamAwaitIdGZH').val());
    config_value1['teamAwaitMsgGZH'] = $.trim($('#teamAwaitMsgGZH').val());
    config_value1['teamSucceedIdGZH'] = $.trim($('#teamSucceedIdGZH').val());
    config_value1['teamFailIdGZH'] = $.trim($('#teamFailIdGZH').val());

    config_value1['freeChargeCallbackIdGZH'] = $.trim($('#freeChargeCallbackIdGZH').val());

    config_value1['openMembershipIdGZH'] = $.trim($('#openMembershipIdGZH').val());

    config_value1['refundIdGZH'] = $.trim($('#refundIdGZH').val());

    config_value1['teamSucceedMsgGZH'] = $.trim($('#teamSucceedMsgGZH').val());
    config_value1['teamFailMsgGZH'] = $.trim($('#teamFailMsgGZH').val());

    config_value1['freeChargeCallbackMsgGZH'] = $.trim($('#freeChargeCallbackMsgGZH').val());

    config_value1['openMembershipMsgGZH'] = $.trim($('#openMembershipMsgGZH').val());

    config_value1['refundMsgGZH'] = $.trim($('#refundMsgGZH').val());

    config_value1['wxTeamBeginIdGZH'] = $.trim($('#wxTeamBeginIdGZH').val());
    config_value1['wxTeamAwaitIdGZH'] = $.trim($('#wxTeamAwaitIdGZH').val());
    config_value1['wxTeamSucceedIdGZH'] = $.trim($('#wxTeamSucceedIdGZH').val());
    config_value1['wxTeamFailIdGZH'] = $.trim($('#wxTeamFailIdGZH').val());

    config_value1['wxFreeChargeCallbackIdGZH'] = $.trim($('#wxFreeChargeCallbackIdGZH').val());

    config_value1['wxOpenMembershipIdGZH'] = $.trim($('#wxOpenMembershipIdGZH').val());

    config_value1['wxMemTemplateIdGZH'] = $.trim($('#wxMemTemplateIdGZH').val());
    config_value1['wxTeamTemplateIdGZH'] = $.trim($('#wxTeamTemplateIdGZH').val());
    config_value1['wxTemplateIdNewOrderGZH'] = $.trim($('#wxTemplateIdNewOrderGZH').val());
    config_value1['wxTemplateIdDeliveryGZH'] = $.trim($('#wxTemplateIdDeliveryGZH').val());
    config_value1['wxTemplateIdCouponExpireGZH'] = $.trim($('#wxTemplateIdCouponExpireGZH').val());
    config_value1['wxTemplateIdCreateUserGZH'] = $.trim($('#wxTemplateIdCreateUserGZH').val());

    config_value1['wxRefundIdGZH'] = $.trim($('#wxRefundIdGZH').val());
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#GHZtemplateConfigId').val(),
            configKey: $('#GHZtemplateConfigKey').val(),
            configValue: JSON.stringify(config_value1)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initBaseConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}

/**
 * 资产配置加载
 */
function initAssetConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/asset',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var assetConfig = data.assetConfig;
                if (assetConfig) {
                    if (assetConfig.configId) {
                        $('#assetConfigId').val(assetConfig.configId);
                    }
                    if (assetConfig.configKey) {
                        $('#assetConfigKey').val(assetConfig.configKey)
                    }
                    var info = assetConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#ICTI').val(info.ICTI);
                        $('#DQ').val(info.DQ);
                        $('#DT').val(info.DT);
                        $('#TV').val(info.TV);
                        $('#yearCombo').val(info.yearCombo);
                        $('#partnerCombo').val(info.partnerCombo);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置资产配置
 */
function resetAssetConfig() {
    $('#ICTI').val("");
    $('#DQ').val("");
    $('#DT').val("");
    $('#TV').val("");
    $('#yearCombo').val("");
    $('#partnerCombo').val("");
}

/**
 * 资产配置保存
 */
function saveAssetConfig() {
    var config_value = {};
    config_value['ICTI'] = $('#ICTI').val();
    config_value['DQ'] = $('#DQ').val();
    config_value['DT'] = $('#DT').val();
    config_value['TV'] = $('#TV').val();
    config_value['yearCombo'] = $('#yearCombo').val();
    config_value['partnerCombo'] = $('#partnerCombo').val();
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#assetConfigId').val(),
            configKey: $('#assetConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initAssetConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}


/**
 * 本地生活配置加载
 */
function initLifeConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/life',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var lifeConfig = data.lifeConfig;
                if (lifeConfig) {
                    if (lifeConfig.configId) {
                        $('#lifeConfigId').val(lifeConfig.configId);
                    }
                    if (lifeConfig.configKey) {
                        $('#lifeConfigKey').val(lifeConfig.configKey)
                    }
                    var info = lifeConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#lifeTitle').val(info.lifeTitle);
                        $('#lifeDesc').val(info.lifeDesc);
                        $('#lifeIcon').val(info.lifeIcon);
                        $('#lifeIconImg').attr('src', info.lifeIcon);
                        $('#lifeUrl').val(info.lifeUrl);
                        $('#preferentialCard').val(info.preferentialCard);
                        $('#kingshipVipQuarter').val(info.kingshipVipQuarter);
                        $('#kingshipVipYear').val(info.kingshipVipYear);
                        $('#giftBagCommission1').val(info.giftBagCommission1);
                        $('#giftBagCommission2').val(info.giftBagCommission2);
                        $('#shareCommission').val(info.shareCommission);
                        $('#storesShareCommission').val(info.storesShareCommission);
                        $('#kingshipCommission1').val(info.kingshipCommission1);
                        $('#kingshipCommission2').val(info.kingshipCommission2);
                        $('#refRegisterCouponImgUrl').val(info.refRegisterCouponImgUrl);
                        $('#viewRefRegisterCouponImgUrl').attr('src', info.refRegisterCouponImgUrl);
                        $('#centreRefRegisterCouponImgUrl').val(info.centreRefRegisterCouponImgUrl);
                        $('#centreViewRefRegisterCouponImgUrl').attr('src', info.centreRefRegisterCouponImgUrl);
                        $('#refRegisterLogoImgUrl').val(info.refRegisterLogoImgUrl);
                        $('#viewRefRegisterLogoImgUrl').attr('src', info.refRegisterLogoImgUrl);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 重置本地生活配置
 */
function resetLifeConfig() {
    $('#lifeTitle').val('');
    $('#lifeDesc').val('');
    $('#lifeIcon').val('');
    $('#lifeUrl').val('');
    $('#preferentialCard').val('');
    $('#kingshipVipQuarter').val(info.kingshipVipQuarter);
    $('#kingshipVipYear').val(info.kingshipVipYear);
    $('#lifeIconImg').attr('src', '');
    $('#giftBagCommission1').val("");
    $('#giftBagCommission2').val("");
    $('#shareCommission').val("");
    $('#storesShareCommission').val("");
    $('#kingshipCommission1').val("");
    $('#kingshipCommission2').val("");
    $('#refRegisterCouponImgUrl').val("");
    $('#viewRefRegisterCouponImgUrl').attr('src', "");
    $('#centreRefRegisterCouponImgUrl').val("");
    $('#centreViewRefRegisterCouponImgUrl').attr('src', "");
    $('#refRegisterLogoImgUrl').val("");
    $('#viewRefRegisterLogoImgUrl').attr('src', "");
}


/**
 * 本地生活配置保存
 * 电子名片配置保存
 */
function saveLifeConfig() {
    var config_value = {};

    config_value['lifeTitle'] = $('#lifeTitle').val();
    config_value['lifeDesc'] = $('#lifeDesc').val();
    config_value['lifeIcon'] = $('#lifeIcon').val();
    config_value['lifeUrl'] = $('#lifeUrl').val();
    config_value['preferentialCard'] = $('#preferentialCard').val();
    config_value['kingshipVipQuarter'] = $('#kingshipVipQuarter').val();
    config_value['kingshipVipYear'] = $('#kingshipVipYear').val();
    config_value['giftBagCommission1'] = $('#giftBagCommission1').val();
    config_value['giftBagCommission2'] = $('#giftBagCommission2').val();
    config_value['kingshipCommission1'] = $('#kingshipCommission1').val();
    config_value['kingshipCommission2'] = $('#kingshipCommission2').val();
    config_value['refRegisterCouponImgUrl'] = $('#refRegisterCouponImgUrl').val();
    config_value['centreRefRegisterCouponImgUrl'] = $('#centreRefRegisterCouponImgUrl').val();
    config_value['refRegisterLogoImgUrl'] = $('#refRegisterLogoImgUrl').val();
    config_value['shareCommission'] = $('#shareCommission').val();
    config_value['storesShareCommission'] = $('#storesShareCommission').val();
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#lifeConfigId').val(),
            configKey: $('#lifeConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initLifeConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    })
}

/**
 * 电子名片配置加载
 */
function initCardConfig() {
    $.ajax({
        type: 'POST',
        url: prefix + '/card',
        data: {},
        success: function (data) {
            if (data.code == 0) {
                var lifeConfig = data.cardConfig;
                if (lifeConfig) {
                    if (lifeConfig.configId) {
                        $('#cardConfigId').val(lifeConfig.configId);
                    }
                    if (lifeConfig.configKey) {
                        $('#cardConfigKey').val(lifeConfig.configKey)
                    }
                    var info = lifeConfig.configValue;
                    if (info) {
                        info = JSON.parse(info);
                        $('#vipGradeAmount').val(info.vipGradeAmount);
                        $('#cardAgentCommission').val(info.cardAgentCommission);
                        $('#oneNetWork').val(info.oneNetWork);
                        $('#twoNetWork').val(info.twoNetWork);
                        $('#threeNetWork').val(info.threeNetWork);
                    }
                }
            } else {
                parent.layer.alert(data.msg)
            }
        }
    });
}

/**
 * 电子名片配置
 */
function resetCardConfig() {
    $('#vipGradeAmount').val('');
    $('#cardAgentCommission').val('');
    $('#oneNetWork').val('');
    $('#twoNetWork').val('');
    $('#threeNetWork').val('');
}

/**
 * 电子名片配置保存
 */
function saveCardConfig() {
    var config_value = {};

    config_value['vipGradeAmount'] = $('#vipGradeAmount').val();
    config_value['cardAgentCommission'] = $('#cardAgentCommission').val();
    config_value['oneNetWork'] = $('#oneNetWork').val();
    config_value['twoNetWork'] = $('#twoNetWork').val();
    config_value['threeNetWork'] = $('#threeNetWork').val();
    $.ajax({
        cache: true,
        type: "POST",
        url: prefix + '/saveConfig',
        data: {
            configId: $('#cardConfigId').val(),
            configKey: $('#cardConfigKey').val(),
            configValue: JSON.stringify(config_value)
        },
        async: false,
        error: function (request) {
            parent.layer.alert("Connection error");
        },
        success: function (data) {
            if (data.code == 0) {
                layer.msg("操作成功", {icon: 6});
                initCardConfig();
            } else {
                layer.alert(data.msg)
            }
        }
    });
}


/**
 * 选择模版
 */
function toInformationTemplate(id) {
    // iframe层
    layer.open({
        id: 'group_add',
        type: 2,
        title: '选择模版',
        maxmin: true,
        shadeClose: false, // 点击遮罩关闭层
        area: ['90%', '90%'],
        content: prefix + '/toInformationTemplate/' + id // iframe的url
    });
}

/**
 * 选择模版
 */
function toInformationTemplateGZH(id) {
    // iframe层
    layer.open({
        id: 'group_add',
        type: 2,
        title: '选择模版',
        maxmin: true,
        shadeClose: false, // 点击遮罩关闭层
        area: ['90%', '90%'],
        content: prefix + '/toInformationGZHTemplate/' + id // iframe的url
    });
}

//模版选中回调
function Callback(obj) {
    //debugger
    if (obj.id == 1) {
        $("#memTemplateId").val(obj.idStrs);
        $("#memTemplatemsg").val(obj.nameStrs);
    } else if (obj.id == 2) {
        $("#teamTemplateId").val(obj.idStrs);
        $("#teamTemplatemsg").val(obj.nameStrs);
    } else if (obj.id == 3) {
        $("#templateIdNewOrder").val(obj.idStrs);
        $("#templatemsgNewOrder").val(obj.nameStrs);
    } else if (obj.id == 4) {
        $("#templateIdDelivery").val(obj.idStrs);
        $("#templatemsgDelivery").val(obj.nameStrs);
    } else if (obj.id == 5) {
        $("#templateIdCouponExpire").val(obj.idStrs);
        $("#templatemsgCouponExpire").val(obj.nameStrs);
    } else if (obj.id == 6) {
        $("#templateIdCreateUser").val(obj.idStrs);
        $("#templatemsgCreateUser").val(obj.nameStrs);
    } else if (obj.id == 7) {
        $("#teamBeginId").val(obj.idStrs);
        $("#teamBeginMsg").val(obj.nameStrs);
    } else if (obj.id == 8) {
        $("#teamAwaitId").val(obj.idStrs);
        $("#teamAwaitMsg").val(obj.nameStrs);
    } else if (obj.id == 9) {
        $("#teamSucceedId").val(obj.idStrs);
        $("#teamSucceedMsg").val(obj.nameStrs);
    } else if (obj.id == 10) {
        $("#ticketOverTimeId").val(obj.idStrs);
        $("#ticketOverTimeMsg").val(obj.nameStrs);
    } else if (obj.id == 11) {
        $("#refundId").val(obj.idStrs);
        $("#refundMsg").val(obj.nameStrs);
    } else if (obj.id == 12) {
        $("#battleOrderId").val(obj.idStrs);
        $("#battleOrderMsg").val(obj.nameStrs);
    }
}

//模版选中回调
function CallbackGZH(obj) {
    //debugger
    if (obj.id == 1) {
        $("#memTemplateIdGZH").val(obj.idStrs);
        $("#memTemplatemsgGZH").val(obj.nameStrs);
    } else if (obj.id == 2) {
        $("#teamTemplateIdGZH").val(obj.idStrs);
        $("#teamTemplatemsgGZH").val(obj.nameStrs);
    } else if (obj.id == 3) {
        $("#templateIdNewOrderGZH").val(obj.idStrs);
        $("#templatemsgNewOrderGZH").val(obj.nameStrs);
    } else if (obj.id == 4) {
        $("#templateIdDeliveryGZH").val(obj.idStrs);
        $("#templatemsgDeliveryGZH").val(obj.nameStrs);
    } else if (obj.id == 5) {
        $("#templateIdCouponExpireGZH").val(obj.idStrs);
        $("#templatemsgCouponExpireGZH").val(obj.nameStrs);
    } else if (obj.id == 6) {
        $("#templateIdCreateUserGZH").val(obj.idStrs);
        $("#templatemsgCreateUserGZH").val(obj.nameStrs);
    } else if (obj.id == 7) {
        $("#teamBeginIdGZH").val(obj.idStrs);
        $("#teamBeginMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 8) {
        $("#teamAwaitIdGZH").val(obj.idStrs);
        $("#teamAwaitMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 9) {
        $("#teamSucceedIdGZH").val(obj.idStrs);
        $("#teamSucceedMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 10) {
        $("#teamFailIdGZH").val(obj.idStrs);
        $("#teamFailMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 11) {
        $("#freeChargeCallbackIdGZH").val(obj.idStrs);
        $("#freeChargeCallbackMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 12) {
        $("#openMembershipIdGZH").val(obj.idStrs);
        $("#openMembershipMsgGZH").val(obj.nameStrs);
    } else if (obj.id == 13) {
        $("#refundIdGZH").val(obj.idStrs);
        $("#refundMsgGZH").val(obj.nameStrs);
    }
}


